Accelerated Convolution in Convolutional Neural Networks

ABSTRACT

Described embodiments include a system that includes one or more buffers and circuitry. The circuitry is configured to process a plurality of input values, by identifying each of the input values that is not zero-valued, and, for each value of the identified input values, computing respective products of coefficients of a kernel with the value and storing at least some of the respective products in the buffers. The circuitry is further configured to compute a plurality of output values, by retrieving respective sets of stored values from the buffers, at least some of the retrieved sets including one or more of the products, and summing the retrieved sets. The circuitry is further configured to output the computed output values. Other embodiments are also described.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application claims the benefit of U.S. ProvisionalApplication 62/427,162, entitled “Network-Based System and Method forAccelerating Deep Learning Classification,” filed Nov. 29, 2016, whosedisclosure is incorporated herein by reference.

FIELD OF THE INVENTION

The present invention relates to the field of signal and imageprocessing, and to convolutional neural networks used for deep learningand inference.

BACKGROUND

In the field of artificial intelligence (AI), an artificial neuralnetwork (ANN) may be configured to perform a particular inference task,whereby the ANN infers information regarding previously-unseen data,based on prior training. Examples of inference tasks includeclassification, speech recognition, and object recognition.

A convolutional neural network (CNN) is one type of ANN in whichsuccessive convolution operations are performed. In a convolutionoperation, a convolution kernel, comprising a plurality of coefficients,is used to compute a weighted sum of input values. A convolution kernelmay be of any suitable dimensionality and of any suitable size. Anexample of a CNN is the VGG-16 CNN, developed by the Oxford VisualGeometry Group (VGG), which automatically recognizes objects in animage.

In general, the input to a convolution operation in a CNN may compriseany number of channels. For example, an image input to the first layerof the CNN may comprise three channels—a red channel, a blue channel,and a green channel—such that the image effectively includes threeseparate two-dimensional images. (For convolution operations at deeperlayers of the CNN, even more than three input channels may be present.)The number of channels in the convolution kernel is typically equal tothe number of input channels; thus, for example, an input of size N×M×C,where C is the number of channels, may be convolved with a kernel ofsize K×L×C.

SUMMARY OF THE INVENTION

There is provided, in accordance with some embodiments of the presentinvention, a system that includes one or more buffers, and circuitry.The circuitry is configured to process a plurality of input values, byidentifying each of the input values that is not zero-valued, and, foreach value of the identified input values, computing respective productsof coefficients of a kernel with the value and storing at least some ofthe respective products in the buffers. The circuitry is furtherconfigured to compute a plurality of output values, by retrievingrespective sets of stored values from the buffers, at least some of theretrieved sets including one or more of the products, and summing theretrieved sets. The circuitry is further configured to output thecomputed output values.

In some embodiments, the circuitry is configured to output at least someof the computed output values before processing all of the input values.

In some embodiments, the circuitry is configured to, in response to agiven one of the input values being zero-valued, store a plurality ofzeros in the buffers, without multiplying the given one of the inputvalues by any of the coefficients.

In some embodiments, the system further includes an oscillatorconfigured to clock the circuitry, and the circuitry includes:

zero-comparison circuitry, configured to, during a given clock cycle ofthe oscillator:

-   -   compare a subset of the input values to zero, and    -   based on the comparing, identify, in the subset, one or more        zero-valued input values, and one or more non-zero-valued input        values; and

multiplier circuitry, configured to, during the given clock cycle,multiply each of the non-zero-valued input values by the coefficients,without multiplying any of the zero-valued input values by any of thecoefficients.

In some embodiments, each buffer of the buffers corresponds to adifferent respective coefficient of the coefficients, and the circuitryis configured to store each product of the at least some of the productsin the buffer corresponding to the coefficient from which the productwas computed.

In some embodiments, a number of elements in each of the buffers is lessthan a number of the output values, and the circuitry is configured to,in storing the at least some of the products for one or more of theinput values, overwrite other products that were previously stored bythe circuitry.

In some embodiments, the system further includes an oscillatorconfigured to clock the circuitry, and the circuitry includesaccumulator circuitry configured to, during a given clock cycle of theoscillator:

retrieve at least one of the sets of stored values from the buffers, byretrieving each of the stored values that is stored at a particularindex of a respective one of the buffers, and

compute at least one of the output values, by summing the retrieved oneof the sets.

In some embodiments, each of the input values is derived from an outputof a rectified linear unit (ReLU).

In some embodiments, the system further includes a processor configuredto perform a machine-learned inference task based on the output values.

In some embodiments, the inference task includes an object-recognitiontask.

There is further provided, in accordance with some embodiments of thepresent invention, a method that includes, using circuitry, processing aplurality of input values, by identifying each of the input values thatis not zero-valued, and, for each value of the identified input values,computing respective products of coefficients of a kernel with the valueand storing at least some of the respective products in one or morebuffers. The method further includes computing a plurality of outputvalues, by retrieving respective sets of stored values from the buffers,at least some of the retrieved sets including one or more of theproducts, and summing the retrieved sets. The method further includesoutputting the computed output values.

The present invention will be more fully understood from the followingdetailed description of embodiments thereof, taken together with thedrawings, in which:

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic illustration of a system for deep learning andinference, in accordance with some embodiments of the present invention;and

FIG. 2 is a schematic illustration of a computational unit comprisingcircuitry for performing a convolution operation, in accordance withsome embodiments of the present invention.

DETAILED DESCRIPTION OF EMBODIMENTS Overview

When using a conventional CNN for image processing, each convolutionoperation is performed by passing the kernel over the input image, suchthat the central coefficient of the kernel is successively aligned witheach of the pixels in the image. For each of these kernel positions,each coefficient in the kernel is multiplied by the co-located pixelvalue (i.e., the pixel value with which the coefficient is aligned), andthe resulting products are then summed. Typically, due to the largenumber, and/or size, of the inputs passed through the CNN, extensivecomputational resources, and/or a large amount of computing time, arerequired.

To address this challenge, embodiments of the present inventioncapitalize on the fact that, in many applications, successiveconvolution operations in a CNN are separated by a rectified linear unit(ReLU) layer, which nullifies any negative values in the output from thepreceding convolution operation. (In other words, each ReLU layerapplies, to each input value “x,” the function max(0,x).) Due to theReLU layers, the inputs to each of the convolution operations thatfollow the first convolution operation typically contain a relativelylarge number of zeros, which do not contribute to the result of theconvolution operation. Embodiments of the present invention thereforeperform convolution operations in a manner that reduces the number ofredundant multiply-by-zero operations that are performed.

By way of illustration, Table 1 below represents a hypothetical 5×5image that is output from a ReLU layer. Each value in the tablerepresents the value of a respective pixel in the image. The pixel inthe i^(th) row and j^(th) column of the image will be described as beinglocated at index (i-1,j-1), with the top-left corner pixel being atindex (0,0).

TABLE 1 0 100 0 0 50 0 0 200 0 0 100 0 0 0 0 0 0 0 50 0 0 50 0 0 100

It will be assumed that this image is to be convolved with a 3×3 kernel.The coefficient in the m^(th) row and n^(th) column of this kernel willbe described as being located at index (m-1,n-1), with the top-leftcorner coefficient being at index (0,0).

To convolve this image with the kernel using a conventional convolutiontechnique, the kernel is passed over the image, such that the centralcoefficient of the kernel (at index (1,1)) is aligned with each of the25 pixels in the image. For each of these kernel positions, 9multiplication operations are performed, in that each kernel coefficientis multiplied by its co-located pixel, and the 9 products are thensummed. (Various methods, such as zero-padding of the input image, maybe used to handle the edges of the image.) Hence, assuming that theconvolution circuitry is capable of performing, during each clock cycle,one set of multiplication operations along with the subsequent additionoperation, 25 clock cycles are required to perform the convolution.Given, however, that the vast majority of the pixels in the image arezero-valued, the majority of this processing time is wasted on redundantmultiply-by-zero operations.

In embodiments of the present invention, on the other hand, the kernelis not passed over the input. Instead, the convolution operation issplit into two operations, which are performed in parallel to oneanother. In the first operation, the kernel coefficients are multipliedby the non-zero pixels, but not by more than a relatively small numberof zero-valued pixels. The resulting products are stored in theappropriate locations in one or more indexed buffers. In the secondoperation, the output pixels are computed, by retrieving and summing theproducts stored in the buffers.

Since redundant multiply-by-zero operations are mostly avoided, aconvolution operation may be performed relatively quickly using thistechnique. For example, as described in detail below, for an exampleembodiment, using this technique, it may be possible to convolve theimage of Table 1 with a 3×3 kernel in only nine clock cycles. Moreover,since the computation of the output is performed in parallel to thecomputation and storage of the products, any products that were alreadyused to compute the output may be overwritten, such that the buffersneed not be overly large.

Typically, the functionality described herein is implemented inhardware, such as on a graphics processing unit (GPU),field-programmable gate array (FPGA), or application-specific integratedcircuit (ASIC) comprising one or more computational units, each of whichis configured to perform convolution operations as described herein.

The present application mainly addresses the processing of images, suchthat the terms “pixel” and “value” may be used interchangeably. (Forexample, the expression “input pixel” may be used interchangeably with“input value.”) It is noted, however, that the techniques foraccelerated convolution described herein may be used for processing anyrelevant types of signals, including audio, video, speech, image,communication, geophysical, sonar, radar, medical, or musical signals.(As example of an audio signal to which the techniques described hereinmay be applied is a pulse-code modulation (PCM) encoded audio signal.)In the context of the present application, including the claims, theterm “signal” may refer to any multivalued input or output, including,for example, any of the types of signals referred to above.

It is noted that the operation described above with reference to Table 1is actually a cross-correlation operation, rather than a convolutionoperation. (In a “true” convolution operation, the direction of thekernel is reversed, prior to being passed over the input.) Nevertheless,in accordance with common parlance, the present application refers tothis operation as a “convolution.” In any case, it is noted that theembodiments described herein may be used for both convolution andcross-correlation operations.

Although the present application mainly addresses CNNs, it is noted thatthe circuitry described herein may be used for any suitable application,such as the convolution of a sparse matrix, which includes a largenumber of zeros, with a kernel.

System Description

Reference is initially made to FIG. 1, which is a schematic illustrationof a system 20 for deep learning and inference, in accordance with someembodiments of the present invention. System 20 may be implemented onany suitable computing device, such as, for example, a desktop computer22, comprising a processor 26 (comprising, for example, a centralprocessing unit and random access memory) and a monitor 30.

System 20 implements a CNN, which is trained to perform an inferencetask. In the particular example shown in FIG. 1, this inference taskincludes an object-recognition task, whereby, given an image 32, system20 recognizes, in image 32, any object 34 of a particular predeterminedtype. Following the performance of this task, image 32 may be displayedon monitor 30, with the recognized objects being circled or otherwiseindicated in the image. Alternatively or additionally, system 20 mayimplement one or more other CNNs trained to perform any other suitableinference task, such as, for example, recognizing the voice of aparticular individual in a PCM encoded sound signal.

The CNN functionality of system 20 may be implemented in software thatis run by processor 26. Typically, however, this functionality isimplemented in hardware, on at least one integrated circuit (IC) 24,such as a GPU, an FPGA, or an ASIC. IC 24 comprises one or morecomputational units 21, each of which comprises circuitry configured toperform convolution operations, as further described below withreference to FIG. 2. IC 24 may further comprise at least one oscillator23, configured to clock the computational units. For example, asillustrated in FIG. 1, a single oscillator 23 may clock all of thecomputational units. Alternatively, the computational units may beclocked by separate respective oscillators belonging to IC 24.

In some embodiments, system 20 comprises a plurality of cooperativelynetworked, or otherwise connected, ICs 24, which may collectivelyimplement a single CNN, or implement multiple different CNNs.

In general, system 20 may comprise any suitable input devices 31, suchas a keyboard and/or a mouse, with which a user may select an inferencetask for system 20 to perform. System 20 may also comprise any outputdevices, such as an audio speaker, alternatively or additionally tomonitor 30.

Convolution Circuitry

Reference is now made to FIG. 2, which is a schematic illustration of acomputational unit 21 comprising circuitry for performing a convolutionoperation on an input signal that includes a plurality of input values,in accordance with some embodiments of the present invention. Typically,the circuitry in computational unit 21 comprises one or more of thefollowing components:

(i) Zero-comparison Circuitry (ZC) 27

ZC 27 is configured to compare each of the input values to zero, such asto identify any of the input values that are not zero-valued. Typically,ZC 27 comprises a plurality of comparators 43, such that, during eachclock cycle of oscillator 23 (FIG. 1), ZC 27 may compare a plurality ofthe input values to zero, using a different respective comparator 43 foreach of the input values. (FIG. 2 shows three comparators merely toindicate a plurality; in practice, ZC 27 may comprise any suitablenumber of comparators.)

(ii) Multiplier Circuitry (MC) 33

MC 33 is configured to compute the respective products of a plurality ofconvolution-kernel coefficients with each of the non-zero input valuesidentified by ZC 27. MC 33 comprises a plurality of multipliers 47,which may have any suitable cardinality. For example, MC 33 may compriseW multipliers 47, where W is the number of kernel coefficients, eachmultiplier being configured to multiply the input value passed to MC 33by a different respective one of the kernel coefficients. (Thus, duringeach clock cycle, the input value passed to MC 33 is multiplied by eachone of the kernel coefficients.)

(iii) Buffers 37

One or more buffers 37 temporarily store the products computed by MC 33.Typically, computational unit 21 comprises a plurality of buffers 37,each buffer corresponding to a different respective coefficient of thekernel. In such embodiments, each of the products computed by MC 33 isstored in the buffer corresponding to the coefficient from which theproduct was computed. For example, the products of the coefficient atindex (0,0) of the kernel may be stored in a first buffer 37, theproducts of the coefficient at index (0,1) may be stored in a secondbuffer 37, etc.

(It is noted that not all of the products computed by MC 33 are storedin buffers 37. For example, even though the product of a pixel havingindex (0,0)—i.e., the top-left corner pixel of the image—and acoefficient having index (2,2)—i.e., the bottom-right corner coefficientof a 3×3 kernel—may be computed by MC 33, this product is not stored inbuffers 37, given that this product is not used to compute any outputvalues.)

(iv) Controllers 45

Controllers (CTRL) 45 are configured to store products from MC 33, alongwith any other required values, in buffers 37. In some embodiments, asingle controller 45 manages the storage into all of the buffers; inother embodiments, as illustrated in FIG. 2, a different respectivecontroller 45 manages the storage into each one of the buffers. Asdescribed in detail in the following section of the present description,each controller 45 may, during each clock cycle, receive a respectiveproduct from MC 33, identify whether the product should be stored (asdescribed immediately above), and then, in response to identifying thatthe product should be stored, store the product, along with any requiredzeros, in the buffer that is managed by the controller.

Typically, controllers 45 perform the storage into buffers 37 such thatall of the stored values needed to compute a particular output value arestored at the same index of the buffers. For example, controllers 45 maystore all of the values needed to compute the (0,0) output pixel atindex 0 of the buffers, all of the values needed to compute the (0,1)output pixel at index 1 of the buffers, etc.

(v) Accumulator Circuitry (ACC) 39

ACC 39 is configured to compute the output values, by retrievingrespective sets of stored values from buffers 37, and summing theretrieved sets. For example, during a given clock cycle, ACC 39 maycompute the (0,0) output pixel, by retrieving the values stored at index0 of the buffers, and then summing these values. Subsequently tocomputing a given output value, ACC 39 outputs the value.Advantageously, as further described below, ACC 39 may output at leastsome of the computed output values even before all of the input valuesare processed.

Typically, ACC 39 comprises a plurality of accumulators 49, having anysuitable cardinality. Thus, during a given clock cycle, ACC 39 maycompute a plurality of output values, by computing a differentrespective output value using each accumulator 49. Alternatively, ACC 39may be clocked by a separate oscillator having a shorter period thanoscillator 23, such that, even with a single accumulator, ACC 39 maycompute several output values during a single clock cycle of oscillator23.

In some embodiments, as shown in FIG. 2, computational unit 21 furthercomprises a queue 25 and a multiplexer (MUX) 29. The input values aresuccessively loaded into queue 25. During each clock cycle, ZC 27compares a given number of values in the queue to zero. Based on thiscomparison, ZC 27 controls multiplexer 29 such that multiplexer 29passes one or more identified non-zero input values to MC 33. (Asdescribed in the section below, if a non-zero value is not identified,ZC 27 may cause a zero value to be passed to MC 33.) ZC 27 also notifiescontrollers 45 of any identified zero-valued inputs, such thatcontrollers 45 may store the products from MC 33 (along with zeroscorresponding to the zero-valued inputs) in the appropriate locations inbuffers 37.

In some embodiments, as shown in FIG. 2, computational unit 21 furthercomprises a memory 41; alternatively, a single common memory 41 may beshared by a plurality of computational units. Memory 41 may store theinput values from the signal that is to be convolved, these input valuesbeing retrieved, as needed, by queue 25. (As described above, this inputmay be received by memory 41 from a ReLU unit.) Alternatively oradditionally, memory 41 may store the kernel coefficients (COEFF) forthe convolution operation; these coefficients are retrieved from memory41 by MC 33. Alternatively or additionally, memory 41 may store theoutputs from ACC 39.

Notwithstanding the above, it is noted that the input values may bereceived directly, e.g., over a network, by queue 25 or ZC 27, such thatthere may be no need for memory 41 to store any input values. It isfurther noted that MC 33 may be configured to use particularpredetermined kernel coefficients, such that there may be no need formemory 41 to store any kernel coefficients. Furthermore, ACC 39 may passits output directly to whichever component operates on this output.Thus, in some embodiments, memory 41 may not be required at all.

Although computational unit 21 may be configured to perform convolutionoperations on input having more than two dimensions, typically,computational unit 21 performs a two-dimensional convolution, whereby atwo-dimensional input is convolved with a two-dimensional kernel.Accordingly, to perform a multi-channel convolution operation, aplurality of computational units are used, whereby each computationalunit convolves a single respective channel of the input with thecorresponding channel of the kernel. Subsequently to each computationalunit operating on its respective channel and generating a respectivetwo-dimensional output, summation circuitry on IC 24 sums thetwo-dimensional outputs, thus generating the final result of theconvolution operation.

The result of the convolution operation may be passed to processor 26,to one or more other computational units, or to any other relevantcircuitry. For example, the result may be passed to a ReLU unit, whichnullifies any negative values in the result. (Any other suitableoperation may be performed on the result, before or after the ReLUoperation; for example, a down-sampling operation may be performed afterthe ReLU operation.) Subsequently, the output of the ReLU unit may bepassed to one or more other computational units 21, for performance offurther convolution operations. Alternatively, the output may be passedto other circuitry (such as other circuitry on IC 24), or to processor26, for performance of the desired inference task.

Notwithstanding the particular configuration shown in FIG. 2, it isnoted that the scope of the present disclosure includes any suitableconfiguration of circuitry configured to perform convolution operationsby iterating over the input values (and thus omitting most redundantmultiply-by-zero operations), storing the products of thenon-zero-valued input values and the kernel coefficients in one or morebuffers, and computing the output values by retrieving and summing theseproducts.

Operation of the Convolution Circuitry

The present portion of the description details the operation ofcomputational unit 21. By way of example, it will be assumed that theconvolution kernel is of size 3×3, and that computational unit 21accordingly comprises nine buffers 37, each buffer corresponding to adifferent respective one of the coefficients. Each of the buffers willbe indicated by the notation B(m,n), where (m,n) is the index of thecorresponding kernel coefficient. For example, the buffer B(0,0) storesthe products of the input values with the top-left corner coefficient ofthe kernel, which has the index (0,0).

First, by way of introduction, Table 2 below shows a schema that may beimplemented by controllers 45 for storage in buffers 37, assuming thatthe input signal is of size 5×5.

TABLE 2 Index B (0, 0) B (0, 1) B (0, 2) B (1, 0) B (1, 1) B (1, 2) B(2, 0) B (2, 1) B (2, 2) 0 0 0 0 0 P (0, 0) P (0, 1) 0 P (1, 0) P (1, 1)1 0 0 0 P (0, 0) P (0, 1) P (0, 2) P (1, 0) P (1, 1) P (1, 2) 2 0 0 0 P(0, 1) P (0, 2) P (0, 3) P (1, 1) P (1, 2) P (1, 3) 3 0 0 0 P (0, 2) P(0, 3) P (0, 4) P (1, 2) P (1, 3) P (1, 4) 4 0 0 0 P (0, 3) P (0, 4) 0 P(1, 3) P (1, 4) 0 5 0 P (0, 0) P (0, 1) 0 P (1, 0) P (1, 1) 0 P (2, 0) P(2, 1) 6 P (0, 0) P (0, 1) P (0, 2) P (1, 0) P (1, 1) P (1, 2) P (2, 0)P (2, 1) P (2, 2) 7 P (0, 1) P (0, 2) P (0, 3) P (1, 1) P (1, 2) P (1,3) P (2, 1) P (2, 2) P (2, 3) 8 P (0, 2) P (0, 3) P (0, 4) P (1, 2) P(1, 3) P (1, 4) P (2, 2) P (2, 3) P (2, 4) 9 P (0, 3) P (0, 4) 0 P (1,3) P (1, 4) 0 P (2, 3) P (2, 4) 0 10 0 P (1, 0) P (1, 1) 0 P (2, 0) P(2, 1) 0 P (3, 0) P (3, 1) 11 P (1, 0) P (1, 1) P (1, 2) P (2, 0) P(2, 1) P (2, 2) P (3, 0) P (3, 1) P (3, 2) 12 P (1, 1) P (1, 2) P (1, 3)P (2, 1) P (2, 2) P (2, 3) P (3, 1) P (3, 2) P (3, 3) 13 P (1, 2) P (1,3) P (1, 4) P (2, 2) P (2, 3) P (2, 4) P (3, 2) P (3, 3) P (3, 4) 14 P(1, 3) P (1, 4) 0 P (2, 3) P (2, 4) 0 P (3, 3) P (3, 4) 0 15 0 P (2, 0)P (2, 1) 0 P (3, 0) P (3, 1) 0 P (4, 0) P (4, 1) 16 P (2, 0) P (2, 1) P(2, 2) P (3, 0) P (3, 1) P (3, 2) P (4, 0) P (4, 1) P (4, 2) 17 P (2, 1)P (2, 2) P (2, 3) P (3, 1) P (3, 2) P (3, 3) P (4, 1) P (4, 2) P (4, 3)18 P (2, 2) P (2, 3) P (2, 4) P (3, 2) P (3, 3) P (3, 4) P (4, 2) P (4,3) P (4, 4) 19 P (2, 3) P (2, 4) 0 P (3, 3) P (3, 4) 0 P (4, 3) P (4, 4)0 20 0 P (3, 0) P (3, 1) 0 P (4, 0) P (4, 1) 0 0 0 21 P (3, 0) P (3, 1)P (3, 2) P (4, 0) P (4, 1) P (4, 2) 0 0 0 22 P (3, 1) P (3, 2) P (3, 3)P (4, 1) P (4, 2) P (4, 3) 0 0 0 23 P (3, 2) P (3, 3) P (3, 4) P (4, 2)P (4, 3) P (4, 4) 0 0 0 24 P (3, 3) P (3, 4) 0 P (4, 3) P (4, 4) 0 0 0 0

In accordance with this schema, controllers 45 store, at each givenindex of buffers 37, all of the addends that are needed to compute aparticular output value. Each potentially non-zero addend is indicatedby the notation P(i,j), where P(i,j) is the product of the relevantkernel coefficient with the input pixel having index (i,j). (Asdescribed above and further described below, a given product P(i,j) maynot actually be computed, in the event that the input pixel at index(i,j) is zero-valued.) Table 2 assumes that controllers 45 effectivelyzero-pad the input image to handle convolution along the edges of theimage, by storing a zero for any product that “lies outside the image.”

For example, the first row of Table 2 contains the values stored in therespective first elements of the buffers, at index 0. These valuesinclude the products of the relevant kernel coefficients with theircolocated pixels when the center of the kernel is colocated with the(0,0) pixel; thus, the sum of these values is the output value havingindex (0,0). For example, the value P(0,0) is at index 0 of bufferB(1,1), indicating that this buffer element stores the product of the(0,0) pixel of the image and the (1,1) coefficient—i.e., the centercoefficient—of the kernel. B(0,0), B(0,1), B(0,2), B(1,0), and B(2,0)all store zeros, since, when the center of the kernel is colocated withthe (0,0) pixel, the kernel coefficients corresponding to these bufferslie outside the image.

Similarly, the second row of Table 2 contains the values stored in thesecond element of each of the buffers, at index 1. These values includethe products of the relevant kernel coefficients with their colocatedpixels when the center of the kernel is colocated with the (0,1) pixel;thus, the sum of these values is the output value having index (0,1).For example, the value P(0,1) is at index 1 of buffer B(1,1), indicatingthat this buffer element stores the product of the (0,1) pixel of theimage and the (1,1) coefficient the kernel. B(0,0), B(0,1), and B(0,2)all store zeros, since, when the center of the kernel is colocated withthe (0,1) pixel, the kernel coefficients corresponding to these buffers(constituting the top row of the kernel) lie outside the image.

Further to this introduction, the operation of computational unit 21will now be described, by simulating a convolution of the example imageof Table 1 with a convolution kernel having coefficients {k(m,n)}. Theconvolution will be simulated by showing, for each clock cycle, a firsttable, representing the image, that indicates the input values that areprocessed during the clock cycle, and a second table, similar to Table2, that shows the state of the buffers at the end of the clock cycle.

In the simulation below, it will be assumed that ZC 27 comprises fivecomparators 43, such that, during each clock cycle, ZC 27 may compare upto five input values with zero. It will further be assumed that amaximum of one input value may be multiplied by MC 33 during any givenclock cycle, and that any input values that follow the multiplied inputvalue are processed only during subsequent clock cycles. It will furtherbe assumed that the input image is processed row-by-row, from left toright.

(Notwithstanding the above assumptions, it is noted that ZC 27 maycomprise any suitable number of comparators, and that the pixels of theinput image may be processed in any suitable order. Similarly, asfurther described below, MC 33 may be configured to multiply multipleinput values during a single clock cycle; alternatively or additionally,zero values that follow a given multiplied input value may be processedduring the same clock cycle as is the multiplied input value.)

(i) First Clock Cycle:

During the first clock cycle of oscillator 23, ZC 27 compares the firstfive input pixels stored in queue 25 to zero, using comparators 43.Based on this comparison, ZC 27 identifies that the first non-zero pixelin the queue is the second pixel of the input image, having a value of100. In response to identifying this pixel, ZC 27 instructs MUX 29 topass this pixel to MC 33. Upon receiving this pixel, MC 33 multipliesthe pixel by the kernel coefficients, and passes the resulting productsto controllers 45.

ZC 27 further notifies controllers 45 that one zero precedes the pixelvalue passed to MC 33, such that the controllers may store the productsfrom MC 33, along with any required zero values, in the appropriatelocations in buffers 37. Since the first pixel of the image is notpassed to MC 33, this pixel is not multiplied by any of the kernelcoefficients, such that redundant multiply-by-zero operations areavoided.

Following the processing of the first two pixels of the input image, thepixels in the queue that follow these two pixels move up in the queue,and two new pixels are retrieved from memory 41 by queue 25. A similarloading of queue 25 may occur during each subsequent clock cycle.Alternatively, queue 25 may be loaded in larger “bursts” during some,but not all, of the clock cycles, such that several consecutive clockcycles may pass without any loading of the queue.

Table 3 below shows the input image, with a single asterisk (“*”)indicating those pixels that are compared to zero during the first clockcycle, and a double asterisk (“**”) indicating those pixels that arefurther processed by the circuitry following the comparison.

TABLE 3  0** 100**  0*  0*  50* 0 0 200  0  0 100  0  0 0  0 0 0  0 50  0 0 50   0 0 100 

(As briefly noted above, in some embodiments, even pixels that followthe first non-zero pixel may be processed during the same clock cycle asis the first non-zero pixel. For example, assuming that MC 33 isconfigured to multiply up to two pixels during a single clock cycle, thefirst five pixels of the input image above may be processed during thefirst clock cycle. In other words, during the first clock cycle, inaddition to performing the tasks described above, ZC 27 may instruct MUX29 to pass the fifth pixel to MC 33, and may also notify controllers 45of the two zero-values that precede this pixel.)

Upon receiving the products from MC 33, controllers 45 store theproducts, along with any required zeros, in buffers 37. Table 4 belowshows the status of buffers 37 after this storage is performed. In Table4, the notation k(m,n) indicates the coefficient of the convolutionkernel at index (m,n), and, as in Table 2, the notation B(m,n) indicatesthe buffer that stores any products of k(m,n). Each product stored bycontrollers 45 during the first clock cycle is marked with an appendedpound (“#”) sign. Similarly, each zero that is stored in response tocommunication from ZC 27 is marked by an appended pound sign. (Otherzeros, stored by the controllers for edge handling, are not marked withan appended pound sign.)

It is noted that Table 4 is derived from Table 2, in that each instanceof “P(0,0)” in Table 2 is replaced with “0#,” and each instance of“P(0,1)” is replaced with the appropriate product. (For simplicity,indices at which no values have yet been stored in any of the buffersare omitted from Table 4, and from the analogous tables below.)

Typically, to facilitate writing to buffers 37, each controller 45maintains, for the buffer under its control, a “write index” (“WI”)variable, which is assigned the value of the highest index at which thebuffer has been populated. If the buffer is not populated at all, thebuffer's WI may be assigned a value of −1, NULL, or any other suitablevalue indicating that the buffer has not yet been populated.

Similarly, to facilitate reading from buffers 37, controllers 45 and ACC39 typically maintain a “read index” (“RI”) variable, which is generallyassigned the value of the lowest index at which all of the buffers arepopulated, but for which the buffers have not yet been summed. If noindices have been fully populated (such as at the end of the first clockcycle), RI may be assigned a value of −1, NULL, or any other suitablevalue. During each clock cycle, ACC 39 reads the RI variable, and then,assuming this variable is 0 or greater, sums as many indices as it can,beginning with RI, up to (and including) the minimum of the WIvariables. Specific examples of this functionality are provided below.

TABLE 4 B (0, 0) B (0, 1) B (0, 2) B (1, 0) B (1, 1) B (1, 2) B (2, 0) B(2, 1) B (2, 2) WI = 7 WI = 6 WI = 5 WI = 2 WI = 1 WI = 0 WI = −1 WI =−1 WI = −1 0 0 0 0  0# k (1, 2) * 100# 0 0 0  0# k (1, 1) * 100# 0 0 0 k(1, 0) * 100# 0 0 0 0 0 0 0  0# k (0, 2) * 100#  0# k (0, 1) * 100# k(0, 0) * 100#

During each of the subsequent clock cycles, ZC 27 similarly compares asubset of the input values to zero. In most of the clock cycles, as inthe first clock cycle, ZC 27 identifies, based on this comparison, oneor more zero-valued input values, and one or more non-zero-valued inputvalues. (For example, ZC 27 may identify the first non-zero-valued inputvalue in the subset, along with any preceding zeros.) Subsequently, MC33 multiplies each of the identified non-zero-valued input values by thecoefficients, without multiplying any of the identified zero-valuedinput values by any of the coefficients.

(ii) Second Clock Cycle:

During the second clock cycle, ZC 27 compares the third through seventhpixels of the input image to zero, identifies, based on this comparison,that the fifth pixel is non-zero, and then processes the third throughfifth pixels. Table 5 shows the input image notated, as for Table 3, toindicate the pixels that are compared to zero and processed during thesecond clock cycle.

TABLE 5  0 100   0**  0**  50**  0*  0* 200  0 0 100   0 0 0 0  0  0 050  0  0 50 0 0 100 

Table 6 shows the state of the buffers following the second clock cycle,with a pound sign indicating those values that are stored in the buffersresponsively to the input pixels processed during the second clockcycle.

TABLE 6 B (0, 0) B (0, 1) B (0, 2) B (1, 0) B (1, 1) B (1, 2) B (2, 0) B(2, 1) B (2, 2) WI = 9 WI = 9 WI = 8 WI = 4 WI = 9 WI = 3 WI = −1 WI =−1 WI = −1 0 0 0 0 0 k (1, 2) * 100 0 0 0 0 k (1, 1) *  0# 100 0 0 0 k(1, 0) *  0#  0# 100 0 0 0 0#  0# k (1, 2) * 50# 0 0 0 0# k (1, 1) * 50#0 0 k (0, 2) * 100 0 k (0, 1) *  0# 100 k (0, 0) *  0#  0# 100 0#  0# k(0, 2) *  50# 0# k (0, 1) * 50#(iii) Third Clock Cycle:

Table 7 indicates the input pixels compared and processed during thethird clock cycle.

TABLE 7 0 100  0 0 50  0**  0** 200**  0*  0* 100  0 0 0  0 0 0 0 50   00 50  0 0 100 

Table 8 shows the state of the buffers following the third clock cycle.During the third clock cycle, RI is set to 0, following the fullpopulation of the 0 index of the buffers.

TABLE 8 B (0, 0) B (0, 1) B (0, 2) B (1, 0) B (1, 1) B (1, 2) B (2, 0) B(2, 1) B (2, 2) WI = 13 WI = 12 WI = 11 WI = 8 WI = 7 WI = 6 WI = 3 WI =2 WI = 1 0 0 0 0 0 k (1, 2) * 0  0#  0# 100 0 0 0 0 k (1, 1) * 0  0#  0#k (2, 2) * 100 200# 0 0 0 k (1, 0) * 0 0  0# k (2, 1) * 100 200# 0 0 0 00 k (1, 2) * k (2, 0) * 50 200# 0 0 0 0 k (1, 1) * 0 50 0 0 k (0, 2) * 0 0#  0# 100 0 k (0, 1) * 0  0#  0# k (1, 2) * 100 200# k (0, 0) * 0 0 0# k (1, 1) * 100 200# 0 0 k (0, 2) * k (1, 0) * 50 200# 0 k (0, 1) * 050 0  0#  0#  0#  0# k (0, 2) * 200#  0# k (0, 1) * 200# k (0, 0) * 200#

(iv) Fourth Clock Cycle:

Table 9 indicates the input pixels compared and processed during thefourth clock cycle.

TABLE 9 0 100   0 0 50  0  0 200   0**  0** 100**  0*  0* 0 0 0  0  050  0 0 50  0 0 100 

Table 10, below, shows the state of the buffers at the end of the fourthclock cycle.

During the fourth clock cycle, ACC 39 reads the RI variable, thusidentifying that this variable has a value of 0. ACC 39 further readsthe WI variables, and computes the minimum of these variables (as of theend of the third clock cycle), i.e., 1. In response, ACC 39 computes twosums: a sum of the values stored in the buffers at index 0 (i.e., a sumacross the first row of Table 10), and a sum of the values stored atindex (i.e., a sum across the second row of Table 10). ACC 39 furtheroutputs each of these sums to memory 41, or directly to anothercomputational unit, ReLU circuitry, or any other suitable destination.These output values are then further processed by the CNN, such that,ultimately, processor 26 (or any other processor, such as anotherprocessor on IC 24) performs the required inference task based on theseoutput values.

In Table 10, along with each of the other analogous tables below, eachrow that is summed during the clock cycle to which the table correspondsis marked by a double exclamation sign (“!!”) at the beginning of therow, while each row that was summed during a previous clock cycle ismarked by a single exclamation sign (“!”).

TABLE 10 B (0, 0) B (0, 1) B (0, 2) B (1, 0) B (1, 1) B (1, 2) B (2, 0)B (2, 1) B (2, 2) WI = 16 WI = 15 WI = 13 WI = 11 WI = 10 WI = 8 WI = 6WI = 5 WI = 3 !!0 0 0 0 0 k (1, 2) * 0 0 0 100 !!0 0 0 0 k (1, 1) * 0 00 k (2, 2) * 100 200 0 0 0 k (1, 0) * 0 0 0 k (2, 1) * 0# 100 200 0 0 00 0 k (1, 2) * k (2, 0) *  0# 0# 50 200 0 0 0 0 k (1, 1) * 0  0#  0# 500 0 k (0, 2) * 0 0 0 0 k (2, 1) * 100 100# 0 k (0, 1) * 0 0 0 k (1, 2) *k (2, 0) * 100 200 100# k (0, 0) * 0 0 0 k (1, 1) * 0# 100 200 0 0 k (0,2) * k (1, 0) *  0# 0# 50 200 0 k (0, 1) * 0  0#  0# 50 0 0 0 0 k(1, 1) * 100# 0 0 k (0, 2) * k (1, 0) * 200 100# 0 k (0, 1) * 0# 200 k(0, 0) *  0# 0# 200  0#  0# 0 k (0, 1) * 100# k (0, 0) * 100#

Following the summations performed by ACC 39, the RI variable is updatedto 2.

(v) Fifth Clock Cycle:

Table 11 indicates the input pixels compared and processed during thefifth clock cycle.

TABLE 11 0 100  0 0 50  0 0 200  0 0 100   0**  0**  0**  0**  0** 0 050  0 0 50  0 0 100 

As shown in Table 11, during the fifth clock cycle, ZC 27 does notidentify any non-zero input pixels. Nonetheless, ZC 27 may instruct MUX29 to pass the fifth compared pixel to MC 33, and inform the controllersof the preceding four zeros, as if the fifth pixel were non-zero-valued.Although, as a result, several redundant multiplication operations areperformed, this functionality allows for greater ease of manufacture, inthat the convolution circuitry need not be configured to operatedifferently in the event that no non-zero input pixels are found.(Notwithstanding the above, in some embodiments, the convolutioncircuitry is configured such that if no non-zero input pixels are foundduring a particular clock cycle, ZC 27 simply informs the controllers ofthis fact, and does not instruct MUX 29 to pass any pixels to MC 33.)

During the fifth clock cycle, ACC 39 reads the RI value of 2, andcomputes the minimum of WI (as of the end of the fourth clock cycle),i.e., 3. In response, ACC 39 sums the third and fourth indices of thebuffers.

Table 12 shows the state of the buffers at the end of the fifth clockcycle, assuming that the fifth (zero-valued) pixel is multiplied by thekernel coefficients, as described above. (For simplicity, Table 12, andeach of the similar tables below, omits the WI values; similarly, noexplicit mention of the RI value is made for the clock cycles describedbelow.)

TABLE 12 B (0, 0) B (0, 1) B (0, 2) B (1, 0) B (1, 1) B (1, 2) B (2, 0)B (2, 1) B (2, 2) !0 0 0 0 0 k (1, 2) * 0 0 0 100 !0 0 0 0 k (1, 1) * 00 0 k (2, 2) * 100 200 !!0 0 0 k (1, 0) * 0 0 0 k (2, 1) * 0 100 200 !!00 0 0 0 k (1, 2) * k (2, 0) * 0 0 50 200 0 0 0 0 k (1, 1) * 0 0 0 0 50 00 k (0, 2) * 0 0 0 0 k (2, 1) * 0# 100 100 0 k (0, 1) * 0 0 0 k (1, 2) *k (2, 0) * 0# 0# 100 200 100 k (0, 0) * 0 0 0 k (1, 1) * 0 0# 0# 0# 100200 0 0 k (0, 2) * k (1, 0) * 0 0 0# 0# 0# 50 200 0 k (0, 1) * 0 0 0 00# 0# 50 0 0 0 0 k (1, 1) * 0# 0 k (2, 1) * 100 0# 0 0 k (0, 2) * k (1,0) * 0# 0# k (2, 0) * 200 100 0# 0 k (0, 1) * 0 0# 0# 0# 200 k (0, 0) *0 0 0# 0# 0# 200 0 0 0 0# 0# 0 k (0, 1) * 0# 0 k (1, 1) * 100 0# k (0,0) * 0# 0# k (1, 0) * 100 0# 0# 0# 0# 0# 0# 0# 0# 0# 0 k (0, 1) * 0# k(0, 0) * 0#

(vi) Sixth Clock Cycle:

Table 13 indicates the input pixels compared and processed during thesixth clock cycle.

TABLE 13  0 100  0 0  50  0 0 200  0   0 100  0 0 0   0  0  0**  0**50**  0*  0* 50  0 0  100 

Table 14 shows the state of the buffers at the end of the sixth clockcycle.

TABLE 14 B (0, 0) B (0, 1) B (0, 2) B (1, 0) B (1, 1) B (1, 2) B (2, 0)B (2, 1) B (2, 2) !0 0 0 0 0 k (1, 2) * 0 0 0 100 !0 0 0 0 k (1, 1) * 00 0 k (2, 2) * 100 200 !0 0 0 k (1, 0) * 0 0 0 k (2, 1) * 0 100 200 !0 00 0 0 k (1, 2) * k (2, 0) * 0 0 50 200 !!0 0 0 0 k (1, 1) * 0 0 0 0 50!!0 0 k (0, 2) * 0 0 0 0 k (2, 1) * 0 100 100 !!0 k (0, 1) * 0 0 0 k (1,2) * k (2, 0) * 0 0 100 200 100 !!k (0, 0) * 0 0 0 k (1, 1) * 0 0 0 0100 200 !!0 0 k (0, 2) * k (1, 0) * 0 0 0 0 0 50 200 0 k (0, 1) * 0 0 00 0 0 0 50 0 0 0 0 k (1, 1) * 0 0 k (2, 1) *  0# 100 0 0 0 k (0, 2) * k(1, 0) * 0 0 k (2, 0) *  0#  0# 200 100 0 0 k (0, 1) * 0 0 0 0  0#  0# k(2, 2) * 200 50# k (0, 0) * 0 0 0 0 0  0# k (2, 1) * 200 50# 0 0 0 0 0 0k (2, 0) * 50# 0 k (0, 1) * 0 0 k (1, 1) *  0# 100 0 k (0, 0) * 0 0 k(1, 0) *  0#  0# 100 0 0 0 0  0#  0# k (1, 2) * 50# 0 0 0  0# k (1, 1) *50# 0 0 0 k (1, 0) * 50# 0 k (0, 1) *  0# 0 k (0, 0) *  0#  0# 0  0#  0#k (0, 2) * 50#  0# k (0, 1) * 50# k (0, 0) * 50#(vii) Seventh Clock Cycle:

Table 15 indicates the input pixels compared and processed during theseventh clock cycle.

TABLE 15 0 100  0 0 50  0 0 200 0 0 100  0 0 0 0 0 0 0 50  0**  0** 50** 0 0 100 

Table 16 shows the state of the buffers at the end of the seventh clockcycle.

TABLE 16 B (0, 0) B (0, 1) B (0, 2) B (1, 0) B (1, 1) B (1, 2) B (2, 0)B (2, 1) B (2, 2) !0 0 0 0 0 k (1, 2) * 0 0 0 100 !0 0 0 0 k (1, 1) * 00 0 k (2, 2) * 100 200 !0 0 0 k (1, 0) * 0 0 0 k (2, 1) * 0 100 200 !0 00 0 0 k (1, 2) * k (2, 0) * 0 0 50 200 !0 0 0 0 k (1, 1) * 0 0 0 0 50 !00 k (0, 2) * 0 0 0 0 k (2, 1) * 0 100 100 !0 k (0, 1) * 0 0 0 k (1, 2) *k (2, 0) * 0 0 100 200 100 !k (0, 0) * 0 0 0 k (1, 1) * 0 0 0 0 100 200!0 0 k (0, 2) * k (1, 0) * 0 0 0 0 0 50 200 !!0 k (0, 1) * 0 0 0 0 0 0 050 !!0 0 0 0 k (1, 1) * 0 0 k (2, 1) * 0 100 0 !!0 0 k (0, 2) * k (1,0) * 0 0 k (2, 0) * 0 0 200 100 0 !!0 k (0, 1) * 0 0 0 0 0 0 k (2, 2) *200 50 k (0, 0) * 0 0 0 0 0 0 k (2, 1) *  0# 200 50 0 0 0 0 0 0 k (2,0) *  0# 0 50 0 k (0, 1) * 0 0 k (1, 1) * 0 0  0# k (2, 2) * 100 0 50# k(0, 0) * 0 0 k (1, 0) * 0 0  0# k (2, 1) * 100 0 50# 0 0 0 0 0 k (1,2) * k (2, 0) * 50 50# 0 0 0 0 k (1, 1) *  0# 50 0 0 0 k (1, 0) *  0# 050 0 k (0, 1) * 0 0  0# k (1, 2) * 0 50# k (0, 0) * 0 0  0# k (1, 1) * 050# 0 0 k (0, 2) * k (1, 0) * 50 50# 0 k (0, 1) * 0# 50 k (0, 0) * 0# 50(vii) Eighth Clock Cycle:

Table 17 indicates the input pixels compared and processed during theeighth clock cycle.

TABLE 17 0 100 0 0  50  0 0 200  0  0 100 0 0 0  0 0 0 0 50  0 0 50  0** 0** 100**

Table 18 shows the state of the buffers at the end of the eighth clockcycle. (During the eighth clock cycle, ZC 27 informs the controllersthat no further input values are forthcoming, and the controllerstherefore populate the buffers with the remaining zeros foredge-handling.)

TALBE 18 B (0, 0) B (0, 1) B (0, 2) B (1, 0) B (1, 1) B (1, 2) B (2, 0)B (2, 1) B (2, 2) !0 0 0 0 0 k (1, 2) * 0 0 0 100 !0 0 0 0 k (1, 1) * 00 0 k (2, 2) * 100 200 !0 0 0 k (1, 0) * 0 0 0 k (2, 1) * 0 100 200 !0 00 0 0 k (1, 2) * k (2, 0) * 0 0 50 200 !0 0 0 0 k (1, 1) * 0 0 0 0 50 !00 k (0, 2) * 0 0 0 0 k (2, 1) * 0 100 100 !0 k (0, 1) * 0 0 0 k (1, 2) *k (2, 0) * 0 0 100 200 100 !k (0, 0) * 0 0 0 k (1, 1) * 0 0 0 0 100 200!0 0 k (0, 2) * k (1, 0) * 0 0 0 0 0 50 200 !0 k (0, 1) * 0 0 0 0 0 0 050 !0 0 0 0 k (1, 1) * 0 0 k (2, 1) * 0 100 0 !0 0 k (0, 2) * k (1, 0) *0 0 k (2, 0) * 0 0 200 100 0 !0 k (0, 1) * 0 0 0 0 0 0 k (2, 2) * 200 50!!k (0, 0) * 0 0 0 0 0 0 k (2, 1) * 0 200 50 !!0 0 0 0 0 0 k (2, 0) * 00 50 !!0 k (0, 1) * 0 0 k (1, 1) * 0 0 0 k (2, 2) * 100 0 50 k (0, 0) *0 0 k (1, 0) * 0 0 0 k (2, 1) *  0# 100 0 50 0 0 0 0 0 k (1, 2) * k (2,0) *  0#  0# 50 50 0 0 0 0 k (1, 1) * 0 0#  0# k (2, 2) * 50 100# 0 0 0k (1, 0) * 0 0 0# k (2, 1) * 0 50 100# 0 k (0, 1) * 0 0 0 k (1, 2) * 0 00 0 50 k (0, 0) * 0 0 0 k (1, 1) *  0# 0 0 0 0 50 0 0 k (0, 2) * k (1,0) *  0#  0# 0 0 0 50 50 0 k (0, 1) * 0 0#  0# k (1, 2) * 0 0 0 50 100#k (0, 0) * 0 0 0# k (1, 1) * 0 0 0 0 50 100#

(ix) Ninth Clock Cycle:

During the ninth clock cycle, no further input pixels are processed.Rather, the remaining output values are computed by ACC 39, by summingthe final nine rows of Table 18. Thus, after only nine clock cycles, theconvolution operation is complete.

It is noted that the example above is provided by way of illustrationonly, and that the precise manner in which the circuitry operates mayvary from the above, e.g., with respect to the timing of the variousread and write operations that are performed. (Thus, it is possible, forexample, that the convolution of a 5×5 signal might require 8 or 10clock cycles, rather than 9 clock cycles.)

In the example above, controllers 45 do not overwrite any of the storedvalues that were already retrieved by ACC 39. In other cases, the numberof elements in each of the buffers may be less than the number of theoutput values, and controllers 45 may, in storing the products receivedfrom MC 33 for one or more of the input values, overwrite other productsthat were previously stored by the controllers (and were already used byACC 39). For example, the controllers may, in storing the products,continually cycle through each of the buffers. (Thus, each of thebuffers may be described as a “cyclic buffer.”) Advantageously, thisfunctionality allows the buffers to be smaller than would otherwise bepossible.

For example, given N pixels in the output image, each of the buffers maybe of length L, where L<N. In such a case, addends for the L+1^(st)output pixel may be stored at the first index of the buffers, addendsfor the L+2^(nd) output pixel may be stored at the second index of thebuffers, etc., thus overwriting any values at these indices that werealready used by ACC 39. ACC 39 is configured to interpret the RI and WIvariables accordingly. For example, in response to an RI value of L−1and a minimum WI value of 1, ACC 39 may sum each of the L−^(st), 0^(th),and 1^(st) indices of the buffers, thus computing three output values.

For embodiments in which the buffers are cyclic (as describedimmediately above), the controllers are configured to pause theoperation of ZC 27 and MC 33, by instructing ZC 27 not to perform anycomparisons for one or more clock cycles, in response to the maximum WIreaching a threshold distance from RI. This helps prevent thecontrollers from overwriting values that were not yet read by ACC 39.

It will be appreciated by persons skilled in the art that the presentinvention is not limited to what has been particularly shown anddescribed hereinabove. Rather, the scope of embodiments of the presentinvention includes both combinations and subcombinations of the variousfeatures described hereinabove, as well as variations and modificationsthereof that are not in the prior art, which would occur to personsskilled in the art upon reading the foregoing description. Documentsincorporated by reference in the present patent application are to beconsidered an integral part of the application except that to the extentany terms are defined in these incorporated documents in a manner thatconflicts with the definitions made explicitly or implicitly in thepresent specification, only the definitions in the present specificationshould be considered.

1. A system, comprising: one or more buffers; and circuitry, configuredto: process a plurality of input values, by: identifying each of theinput values that is not zero-valued, and for each value of theidentified input values, computing respective products of coefficientsof a kernel with the value, and storing at least some of the respectiveproducts in the buffers, compute a plurality of output values, by:retrieving respective sets of stored values from the buffers, at leastsome of the retrieved sets including one or more of the products, andsumming the retrieved sets, and output the computed output values. 2.The system according to claim 1, wherein the circuitry is configured tooutput at least some of the computed output values before processing allof the input values.
 3. The system according to claim 1, wherein thecircuitry is configured to, in response to a given one of the inputvalues being zero-valued, store a plurality of zeros in the buffers,without multiplying the given one of the input values by any of thecoefficients.
 4. The system according to claim 3, further comprising anoscillator configured to clock the circuitry, wherein the circuitrycomprises: zero-comparison circuitry, configured to, during a givenclock cycle of the oscillator: compare a subset of the input values tozero, and based on the comparing, identify, in the subset, one or morezero-valued input values, and one or more non-zero-valued input values;and multiplier circuitry, configured to, during the given clock cycle,multiply each of the non-zero-valued input values by the coefficients,without multiplying any of the zero-valued input values by any of thecoefficients.
 5. The system according to claim 1, wherein each buffer ofthe buffers corresponds to a different respective coefficient of thecoefficients, and wherein the circuitry is configured to store eachproduct of the at least some of the products in the buffer correspondingto the coefficient from which the product was computed.
 6. The systemaccording to claim 5, wherein a number of elements in each of thebuffers is less than a number of the output values, and wherein thecircuitry is configured to, in storing the at least some of the productsfor one or more of the input values, overwrite other products that werepreviously stored by the circuitry.
 7. The system according to claim 5,further comprising an oscillator configured to clock the circuitry,wherein the circuitry comprises accumulator circuitry configured to,during a given clock cycle of the oscillator: retrieve at least one ofthe sets of stored values from the buffers, by retrieving each of thestored values that is stored at a particular index of a respective oneof the buffers, and compute at least one of the output values, bysumming the retrieved one of the sets.
 8. The system according to claim1, wherein each of the input values is derived from an output of arectified linear unit (ReLU).
 9. The system according to claim 1,further comprising a processor configured to perform a machine-learnedinference task based on the output values.
 10. The system according toclaim 9, wherein the inference task includes an object-recognition task.11. A method, comprising: using circuitry, processing a plurality ofinput values, by: identifying each of the input values that is notzero-valued, and for each value of the identified input values,computing respective products of coefficients of a kernel with thevalue, and storing at least some of the respective products in one ormore buffers; computing a plurality of output values, by: retrievingrespective sets of stored values from the buffers, at least some of theretrieved sets including one or more of the products, and summing theretrieved sets; and outputting the computed output values.
 12. Themethod according to claim 11, wherein outputting the computed outputvalues comprises outputting at least some of the computed output valuesbefore processing all of the input values.
 13. The method according toclaim 11, further comprising, in response to a given one of the inputvalues being zero-valued, storing a plurality of zeros in the buffers,without multiplying the given one of the input values by any of thecoefficients.
 14. The method according to claim 13, wherein anoscillator clocks the circuitry, and wherein processing the input valuescomprises, during a given clock cycle of the oscillator: comparing asubset of the input values to zero; based on the comparing, identifying,in the subset, one or more zero-valued input values, and one or morenon-zero-valued input values; and multiplying each of thenon-zero-valued input values by the coefficients, without multiplyingany of the zero-valued input values by any of the coefficients.
 15. Themethod according to claim 11, wherein each buffer of the bufferscorresponds to a different respective coefficient of the coefficients,and wherein storing the at least some of the respective products in thebuffers comprises storing each product of the at least some of theproducts in the buffer corresponding to the coefficient from which theproduct was computed.
 16. The method according to claim 15, wherein anumber of elements in each of the buffers is less than a number of theinput values, and wherein storing the at least some of the products, forone or more of the input values, comprises overwriting other productsthat were previously stored by the circuitry.
 17. The method accordingto claim 15, wherein an oscillator clocks the circuitry, and whereincomputing the output values comprises, during a given clock cycle of theoscillator: retrieving at least one of the sets of stored values fromthe buffers, by retrieving each of the stored values that is stored at aparticular index of a respective one of the buffers, and computing atleast one of the output values, by summing the retrieved one of thesets.
 18. The method according to claim 11, wherein each of the inputvalues is derived from an output of a rectified linear unit (ReLU). 19.The method according to claim 11, further comprising performing amachine-learned inference task based on the output values.
 20. Themethod according to claim 19, wherein performing the inference taskcomprises recognizing an object in an image.